using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Controls
{
    public class ForumSelectedArgs : EventArgs
    {
        public ForumSelectedArgs(DAL.Forum selectedForum)
        {
            Forum = selectedForum;
        }

        private DAL.Forum _forum;
        public DAL.Forum Forum
        {
            get
            {
                return _forum;
            }
            set
            {
                _forum = value;
            }
        }
    }

    public abstract class DataManagerForumControl : BaseDataManagerControl<DAL.Forum>
    {
        public delegate void ForumSelectedDelegate(object sender, ForumSelectedArgs e);
        public event ForumSelectedDelegate ForumSelected;

        public DAL.Forum CurrentForum
        {
            get
            {
                return CurrentItem;
            }
            set
            {
                CurrentItem = value;
            }
        }

        public override string QueryStringName
        {
            get
            {
                return "f";
            }
        }

        protected override DAL.Forum GetItem(long id)
        {
            return DAL.Forums.Item(id);
        }

        protected void RaiseForumSelected()
        {
            if (ForumSelected != null)
            {
                ForumSelected(this, new ForumSelectedArgs(CurrentForum));
            }
        }
    }
}
